package HomeWork;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class Demo02 {
    public static void main(String[] args) {
        try(FileInputStream fis=new FileInputStream("D:\\img1.jpg");
            FileOutputStream fos=new FileOutputStream("D:\\img2.jpg")){

            int d;
            byte[] bytes=new byte[1024];
            while((d=fis.read(bytes))!=-1){
                fos.write(bytes,0,d);
            }
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
